# Contributor: Bart Ribbers <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-frameworks
maintainer="team/kde <bribbers@disroot.org>"
pkgname=knewstuff
pkgver=6.7.0
pkgrel=0
pkgdesc="Framework for downloading and sharing additional application data"
# armhf blocked by qt6-qtdeclarative
arch="all !armhf"
url="https://community.kde.org/Frameworks"
license="LGPL-2.1-or-later"
depends="kirigami"
depends_dev="
	karchive-dev
	kcompletion-dev
	kconfig-dev
	kcoreaddons-dev
	ki18n-dev
	kiconthemes-dev
	kio-dev
	kitemviews-dev
	kpackage-dev
	kservice-dev
	ktextwidgets-dev
	kwidgetsaddons-dev
	kxmlgui-dev
	qt6-qtbase-dev
	qt6-qtdeclarative-dev
	"
makedepends="$depends_dev
	doxygen
	extra-cmake-modules
	qt6-qttools-dev
	samurai
	"
checkdepends="xvfb-run"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
_repo_url="https://invent.kde.org/frameworks/knewstuff.git"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/knewstuff-$pkgver.tar.xz"

case "$CARCH" in
s390x)
	# times out in knewstuff-installationtest after 300s
	options="$options !check"
	;;
esac

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_TESTING=ON \
		-DBUILD_QCH=ON
	cmake --build build
}

check() {
	XDG_RUNTIME_DIR="$(mktemp -p -d "$builddir")" \
	xvfb-run -a ctest --test-dir build --output-on-failure -E "knewstuff-atticaprovidertest"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
41921e155abc05479c9aceb8dc64330b025d6fab073effd186d4f5a6467816d6b415e6b39c4a61e0782f3f4a29295982f9966e40877c96244d2ddea3fc6bc3fa  knewstuff-6.7.0.tar.xz
"
